/*        WB INDUSTRIES, LLC
                Will Bootle
                    Randomizer
*/



// including librarys

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//creating a struct
struct person{
    char first[100];
    char last[100];
    int marked;
};


//scaning function
struct person scan(){
    struct person man;
    
    printf("input first name\n");
    scanf("%s",man.first);
    printf("input last name\n");
    scanf("%s",man.last);
    man.marked = 0;
    
    return(man);
}
//requesting names for victims
int main(int argc, const char * argv[])
{
    struct person listofpeople[17];
    struct person randlistofpeople[17];
    
    for(int i =0;i <= 17;i++){
        
        listofpeople[i] = scan();
        //printing creepy message
        printf("%s %s has been marked for death. \n \n", listofpeople[i].first, listofpeople[i].last);
        
    }
    //randomizing the array
    for(int i = 0;i <= 17; i++){
        int test = rand() % 18;
        while(listofpeople[test].marked == 1){
            test = rand() % 18;
        }
        listofpeople[test].marked = 1;
        randlistofpeople[i] = listofpeople[test];
    }
    
    for(int i =0;i <= 17;i++){
        //printing targets from array
        
        //fixing a bug with the program passing 18 and crashing
        if (i == 17) {
            printf("%s %s's target is: %s %s \n", randlistofpeople[i].first, randlistofpeople[i].last, randlistofpeople[0].first, randlistofpeople[0].last);
        }else {
            printf("%s %s's target is: %s %s \n", randlistofpeople[i].first, randlistofpeople[i].last, randlistofpeople[i+1].first, randlistofpeople[i+1].last);
        }
    }

    return 0;
}
